//引入项目中全部的全局属性
import SvgIcon from '@/components/SvgIcon/index.vue'
import Pagination from '@/components/Pagination/index.vue'
import Category from '@/components/Category/index.vue'
import type { App } from 'vue';
//引入element-plus提供全部图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//全局对象
const allGlobalComponent: any = { SvgIcon, Pagination, Category}
// console.log(allGlobalComponent)
// console.log(Object.keys(allGlobalComponent))

//对外暴露插件对象
export default {
    //务必叫做install方法
    install(app:App) {
        Object.keys(allGlobalComponent).forEach(key => {
            app.component(key,allGlobalComponent[key]);
        })
        //将element-plus提供图标注册为全局组件
        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        app.component(key, component)
        }
    },
}